#{extends 'home.html'/}

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>

<script type="text/javascript" src="@{'/public/javascripts/jquery.fancybox-1.3.4.pack.js'}"></script>
<link rel="stylesheet" href="@{'/public/stylesheets/jquery.fancybox-1.3.4.css'}" type="text/css" media="screen" />


#{if flash.success}
	<h2 style="color:green"><img src="@{'public/images/tick-icon.png'}"/> ${flash.success}</h2>
#{/if}
<h1 class="viewTitle">Merge Requests</h1> 

<div class="viewContent">
#{if requests.size()==0}
	<h2>You have no merge Requests</h2>
#{/if}
#{else}
<table border="0" cellspacing="0">
#{list requests,as:'request'}
<tr>
 <th>Merge</th>
  <th>From</th>
  <th>    </th>
 <th>Date</th>
 <th>Accept/Reject</th>
</tr>
<tr>
 <td>
	<a href="@{Browse.viewIdea(request.firstIdea.id)}">${request.firstIdea.title}</a>,
	<a href="@{Browse.viewIdea(request.secondIdea.id)}"> ${request.secondIdea.title}</a>
 </td>
 <td><a href="@{Users.viewUserProfile(request.sender.userName)}">${request.sender.userName}</a><td>
 <td>${request.date.format('dd/MM/yyyy hh:mm')}</td>
 <td>
	<div id="${request.id}">
	<form action="@{ProfileController.sendRejectionMail()}">
	<input type="hidden" value="${request.id}" name="requestId"/>
	<input type="submit" name="delete" id="delete" value="Reject the Request!"/>
	</form>
	<form action="@{ProfileController.viewMergeIdeas()}">
	<input type="hidden" value="${request.id}" name="requestId"/>
	<input type="submit" name="merge" id="merge" value="Start Merging Ideas"/>
	</form>
	</div>
 </td>
 </tr>
#{/list}
</table>

#{/else}

</div>